using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using FarseerGames.FarseerPhysics.Dynamics;
using FarseerGames.FarseerPhysics.Collisions;
using Microsoft.Xna.Framework;

namespace StupidSpaceThing
{
	internal class ColCircle : ColObject
	{
		private Quad quad;
		private float radius;
		public float Radius { get { return radius; } }		

		public ColCircle(Entity entity, float mass, float radius)
			: base(entity, BodyFactory.Instance.CreateCircleBody(Game1.Simulator, radius, mass)) {
			this.geom = GeomFactory.Instance.CreateCircleGeom(Game1.Simulator, Body, radius, 10);
			this.radius = radius;
			if( Game1.GenCollisionObjects ) {
				quad = new Quad(Game1.SelectionTexture);
			}
		}

		public override bool Within(Vector2 point) {
			if( Vector2.Distance(Position2D, point) < Radius ) {
				return true;
			}
			return false;
		}

		public override void Draw(Camera camera){
			quad.Color = Color;
			quad.Position = Position;
			quad.Scale = radius * 1.1f;
			quad.Draw(camera);
		}
	}
}
